package org.zanateh.wargame.game.moveevaluators;

import org.zanateh.wargame.game.hexagon.HexField;
import org.zanateh.wargame.game.hexagon.Hexagon;
import org.zanateh.wargame.game.hexagon.HexField.NotInitializedException;
import org.zanateh.wargame.game.util.Coordinate;

public class AdjacentMoveEvaluator extends MoveEvaluator {

	@Override
	public boolean allowMove(Hexagon pHex) {
	
		Coordinate pieceCoord;
		try {
			pieceCoord = getAttachedPiece().getHex().getCoordinate();
			return pieceCoord.isAdjacentTo(pHex.getCoordinate());
		} catch (NotInitializedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	@Override
	public String getRejectedMessage() {
		// TODO Auto-generated method stub
		return "The target hex is not adjacent to the piece's current position.";
	}
	
}
